package com.clouddong.exterapi.util;

import com.clouddong.exterapi.websocket.WebSocket;

import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * @Auther: xuan
 * @Date: 2018/8/8/008 14:31
 * @Description:转发消息的中间件
 */
public class WebSocketMapUtil {

    public static ConcurrentMap<String, WebSocket> webSocketMap = new ConcurrentHashMap<>();
    public static void put(String key, WebSocket myWebSocket){
        webSocketMap.put(key, myWebSocket);
    }

    public static WebSocket get(String key){
        return webSocketMap.get(key);
    }

    public static void remove(String key){
        webSocketMap.remove(key);
    }

    public static Collection<WebSocket> getValues(){
        return webSocketMap.values();
    }
}
